package com.jingli.pile.converter;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jingli.pile.entity.ChargingPort;
import com.jingli.pile.entity.SupConnectorInfo;
import com.jingli.pile.entity.SupEquipmentInfo;
import com.jingli.pile.service.SupEquipmentInfoService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component
public class ConnectorConverter {
    private Logger logger = LoggerFactory.getLogger(ConnectorConverter.class);
    @Autowired
    private SupEquipmentInfoService equipmentInfoService;

    public ChargingPort convertPortFromConnector(SupConnectorInfo connectorInfo){
        ChargingPort port = new ChargingPort();
        port.setState("N");
        port.setPower("0");
        port.setParkid(connectorInfo.getParkNo());
        port.setName(connectorInfo.getConnectorName());
        port.setGunInsert("0");
        port.setDeviceid(connectorInfo.getConnectorId());
        port.setCreatetime(new Date());
        return port;
    }

    public SupConnectorInfo convertConnectorFromPort(ChargingPort port){
        SupConnectorInfo connectorInfo = new SupConnectorInfo();
        connectorInfo.setConnectorId(String.valueOf(port.getId()));
        connectorInfo.setConnectorType("2");
        connectorInfo.setVoltageLowerLimits(220);
        connectorInfo.setVoltageUpperLimits(220);
        connectorInfo.setCurrent(15);
        connectorInfo.setPower(7.0);
        connectorInfo.setConnectorName(port.getName());
        connectorInfo.setNationalStandard(3);
        connectorInfo.setAuxPower(3);
        connectorInfo.setOpreateHours("");
        connectorInfo.setOpreateStatus(50);
        connectorInfo.setEquipmentClassification(1);
        connectorInfo.setEquipmentId(port.getParkid());
        return connectorInfo;
    }
}
